import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layouts/default.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/index',
    component: Layout,
    children: [
      {
        // 系统首页
        path: '/index',
        name: 'index',
        component: () => import('@/views/home/index.vue'),
      },
      {
        // 消息页面
        path: '/xxgl',
        name: 'xxgl',
        component: () => import('@/views/xxgl/index.vue'),
      },
      {
        // 案件归档
        path: '/ajgd',
        name: 'ajgd',
        meta: { title: '案件归档' },
        component: () => import('@/views/gdgl/ajgd/index.vue'),
      },
      {
        // 案件锁定解除
        path: '/ajsdjc',
        name: 'ajsdjc',
        meta: { title: '案件锁定解除' },
        component: () => import('@/views/gdgl/ajsdjc/index.vue'),
      },
      {
        // 集中扫描
        path: '/jzsm',
        name: 'jzsm',
        meta: { title: '集中扫描' },
        component: () => import('@/views/gdgl/jzsm/index.vue'),
      },
      {
        // 检察官审核
        path: '/jcgsh',
        name: 'jcgsh',
        meta: { title: '检察官审核' },
        component: () => import('@/views/gdgl/jcgsh/index.vue'),
      },
      {
        // 档案初验
        path: '/dacy',
        name: 'dacy',
        meta: { title: '档案初验' },
        component: () => import('@/views/gdgl/dacy/index.vue'),
      },
      {
        // 档案复验
        path: '/dafy',
        name: 'dafy',
        meta: { title: '档案复验' },
        component: () => import('@/views/gdgl/dafy/index.vue'),
      },
      {
        // 档案管理
        path: '/dagl',
        name: 'dagl',
        meta: { title: '档案管理' },
        component: () => import('@/views/gdgl/dagl/index.vue'),
      },
      {
        // 退改审批
        path: '/tgsh',
        name: 'tgsh',
        meta: { title: '退改审批' },
        component: () => import('@/views/gdgl/tgsh/index.vue'),
      },
      {
        // 文件任务管理
        path: '/wjrwgl',
        name: 'wjrwgl',
        meta: { title: '文件任务管理' },
        component: () => import('@/views/gdgl/wjrwgl/index.vue'),
      },
      {
        // 归档配置
        path: '/gdpz',
        name: 'gdpz',
        meta: { title: '归档配置' },
        component: () => import('@/views/xtpz/gdpz/index.vue'),
      },
      {
        // 超期预警配置
        path: '/cqyjpz',
        name: 'cqyjpz',
        meta: { title: '超期预警配置' },
        component: () => import('@/views/xtpz/cqyjpz/index.vue'),
      },
      {
        // 数据包导出配置
        path: '/sjbdcpz',
        name: 'sjbdcpz',
        meta: { title: '数据包导出配置' },
        component: () => import('@/views/xtpz/sjbdcpz/index.vue'),
      },
      // {
      //   // 组织机构
      //   path: '/zzjg',
      //   name: 'zzjg',
      //   meta: { title: '组织机构' },
      //   component: () => import('@/views/xtpz/zzjg/index.vue'),
      // },
      // {
      //   // 功能组件
      //   path: '/gnzj',
      //   name: 'gnzj',
      //   meta: { title: '功能组件' },
      //   component: () => import('@/views/xtpz/gnzj/index.vue'),
      // },
      {
        // 用户权限
        path: '/yhqx',
        name: 'yhqx',
        meta: { title: '用户权限' },
        component: () => import('@/views/xtpz/yhqx/index.vue'),
      },
      {
        // 日志查询
        path: '/rzcx',
        name: 'rzcx',
        meta: { title: '日志查询' },
        component: () => import('@/views/xtpz/rzcx/index.vue'),
      },
      // {
      //   // 数据字典
      //   path: '/bydm',
      //   name: 'bydm',
      //   meta: { title: '数据字典' },
      //   component: () => import('@/views/xtpz/bydm/index.vue'),
      // },
      {
        // 归档预警
        path: '/gdyj',
        name: 'gdyj',
        meta: { title: '归档预警' },
        component: () => import('@/views/gdjd/gdyj/index.vue'),
      },
      {
        // 监督记录
        path: '/jdjl',
        name: 'jdjl',
        meta: { title: '监督记录' },
        component: () => import('@/views/gdjd/jdjl/index.vue'),
      },
      {
        // 监督反馈
        path: '/jdfk',
        name: 'jdfk',
        meta: { title: '监督反馈' },
        component: () => import('@/views/gdjd/jdfk/index.vue'),
      },
      {
        // 监督统计
        path: '/jdtj',
        name: 'jdtj',
        meta: { title: '监督统计' },
        component: () => import('@/views/gdjd/jdtj/index.vue'),
      },
      {
        // 档案借阅
        path: '/dajy',
        name: 'dajy',
        meta: { title: '档案借阅' },
        component: () => import('@/views/daly/dajy/index.vue'),
      },
      {
        // 借阅管理
        path: '/jygl',
        name: 'jygl',
        meta: { title: '借阅管理' },
        component: () => import('@/views/daly/jygl/index.vue'),
      },
      {
        // 借阅管理
        path: '/jysp',
        name: 'jysp',
        meta: { title: '借阅审批' },
        component: () => import('@/views/daly/jysp/index.vue'),
      },
      {
        // 归档情况查询
        path: '/gdqkcx',
        name: 'gdqkcx',
        meta: { title: '归档情况查询' },
        component: () => import('@/views/cxtj/gdqkcx/index.vue'),
      },
      {
        // 归档制作量统计
        path: '/gdzzltj',
        name: 'gdzzltj',
        meta: { title: '归档制作量统计' },
        component: () => import('@/views/cxtj/gdzzltj/index.vue'),
      },
      {
        // 借阅情况统计
        path: '/jyqktj',
        name: 'jyqktj',
        meta: { title: '借阅情况统计' },
        component: () => import('@/views/cxtj/jyqktj/index.vue'),
      },
      {
        // 存储统计
        path: '/cctj',
        name: 'cctj',
        meta: { title: '存储统计' },
        component: () => import('@/views/cxtj/cctj/index.vue'),
      },
      // {
      //   // 档案查询
      //   path: '/dacx',
      //   name: 'dacx',
      //   meta: { title: '档案查询' },
      //   component: () => import('@/views/cxtj/dacx/index.vue'),
      // },
      // {
      //   // 档案统计
      //   path: '/datj',
      //   name: 'datj',
      //   meta: { title: '档案统计' },
      //   component: () => import('@/views/cxtj/datj/index.vue'),
      // },
    ],
  },
  {
    // 归档整理
    path: '/gdzl',
    name: 'gdzl',
    component: () => import('@/views/gdgl/gdzl/index.vue'),
  },
  {
    // 集中扫描整理
    path: '/jzsmzl',
    name: 'jzsmzl',
    component: () => import('@/views/gdgl/jzsm/components/gdzl/index.vue'),
  },
  {
    // 审核整理端（无功能页面）
    path: '/jcgshxq',
    name: 'jcgshxq',
    component: () => import('@/views/gdgl/jcgsh/component/gdzl/index.vue'),
  },
  {
    // 个案查阅，配置在2.0
    path: '/gacy',
    name: 'gacy',
    component: () => import('@/views/gdgl/gacy/index.vue'),
  },
  {
    // 门户个案全景
    path: '/gaqj',
    name: 'gaqj',
    component: () => import('@/views/gdgl/gaqj/index.vue'),
  },
  {
    // 登录
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
  },
  // {
  //   // 流程图配置
  //   path: '/flowconfig',
  //   name: 'flowconfig',
  //   component: () => import('@/views/flowconfig/index.vue'),
  // },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

// router.beforeEach((to, from, next) => {
//   const vuex = JSON.parse(window.sessionStorage.getItem('vuex') as any)
//   if (to.path === '/index' || to.path === '/' || to.path === '/404') {
//     next()
//   } else {
//     if (!vuex) {
//       next('/')
//     }
//     // const gndz = fontUrl(vuex.personInfo.gnList)
//     // const arr = gndz.filter(el => el.gndz === to.path)
//     const arr = []
//     if (arr.length > 0) {
//       next()
//     } else {
//       next({
//         path: '/404'
//       })
//     }
//   }
// })

export default router
